# -*- coding: utf-8 -*-

from playwright.sync_api import Playwright, sync_playwright, expect
def run(playwright: Playwright) -> None:
    browser = playwright.chromium.launch(headless=False)
    # 加载本地cookies，免登陆
    context = browser.new_context(storage_state="state.json")

    # 打开页面继续操作
    page = context.new_page()
    page.goto('http://192.168.7.102/users/sign_in')
    page.pause()  # 打断点看是不是已经登录了

    context.close()
    browser.close()

if __name__ == '__main__':

    with sync_playwright() as playwright:
        run(playwright)

